package panel.aboutUs
{
	import assists.HtmlText;
	import assists.Lang;
	import assists.TextFieldUtils;
	import assists.URI;
	import assists.resource.ResourceLoader;
	
	import flash.display.DisplayObject;
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.text.TextField;
	
	import inerface.IAboutUsPanel;
	
	import main.ClientConstants;
	
	public class AboutUsPanel extends Sprite implements IAboutUsPanel
	{
		private var _stage:Stage;
		private var _loader:ResourceLoader;
		private var _lang:Lang;
		private var _uri:URI;
		
//		private var back:DisplayObject;
		private var titleText:TextField;
		private var infoText:TextField;
		
		public function AboutUsPanel()
		{
			super();
		}
		
		public function changeData(str:String):void
		{
			TextFieldUtils.setHtmlText(infoText,HtmlText.formatSizeColor(str,0xFFFFFF,18));
		}
		
		public function init(stage:Stage, loader:ResourceLoader, lang:Lang, uri:URI=null):void
		{
			_stage = stage;
			_loader = loader;
			_lang = lang;
			_uri = uri;
			
			initThis();
		}
		
		private function initThis():void
		{
//			back = new _loader.uiManager.paperImageBack() as DisplayObject;
//			this.addChild(back);
			
			titleText = new TextField;
			titleText.mouseEnabled = true;
			titleText.selectable = false;
			titleText.multiline = false;
			titleText.wordWrap = false;
			
			TextFieldUtils.setHtmlText(titleText,HtmlText.formatSizeColor("<b>关于我们</b>",0xFFFFFF,20));
			titleText.width = titleText.textWidth + 5;
			titleText.height = titleText.textHeight + 5;
			
			infoText = new TextField;
			infoText.mouseEnabled = true;
			infoText.selectable = false;
			infoText.multiline = true;
			infoText.wordWrap = true;
			
			reSize();
		}
		
		private function reSize():void
		{
//			back.width = _stage.stageWidth;
//			back.height = _stage.stageHeight * .82;
//			
//			back.x = 0;
//			back.y = _stage.stageHeight * ClientConstants.HOME_UP_PER;
			
			this.addChild(titleText);
			this.addChild(infoText);
			
			titleText.x = (_stage.stageWidth - titleText.width) / 2;
			titleText.y = _stage.stageHeight * .13;
			
			infoText.width = _stage.stageWidth * .9;
			infoText.height = _stage.stageHeight * .62;
			
			infoText.x = _stage.stageWidth * .05;
			infoText.y = _stage.stageHeight * .23;
		}
		
		public function clear():void
		{
			if(_stage){
				_stage = null;
				_loader = null;
				_lang = null;
				_uri = null;
				
//				back = null;
			}
		}
	}
}